<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<link rel="shortcut icon" href="images/favicon.png">
<link rel="icon" href="images/favicon.png">
<script type="text/javascript">
var page_modified = 0;
var restart_time = 0;

var current_page = '<% get_parameter("current_page"); %>';
var next_page = '<% get_parameter("next_page"); %>';
var action_script = '<% get_parameter("action_script"); %>';
var group_id = '<% get_parameter("group_id"); %>';
var getflag = '<% get_parameter("flag"); %>';

function started_validating(){
}

function done_validating(action){
	parent.done_validating(action, group_id);
}

function started_committing(){
}

function done_committing(){
	page_modified = 1;
}

function no_changes_and_no_committing(){
}

function invalid_variable_value(variable, bad_value, message){
}

function restart_needed_time(second){
	restart_time = second;
}

function delay_redirect(next_url){
	document.redirectForm.action = next_url;
	document.redirectForm.target = "";
	document.redirectForm.submit();
}

function top_delay_redirect(next_url){
	document.redirectForm.action = next_url;
	document.redirectForm.target = "_parent";
	document.redirectForm.submit();
}

function redirect(){
	parent.location.href = 'http://'+parent.document.form.lan_ipaddr.value;
}

function initial(){
	if(getflag == "set_language"){
		if(navigator.appName.indexOf("Microsoft") >= 0)
			parent.parent.location.reload();
		else{
			parent.parent.location.href = parent.parent.location.href;
		}
	}
	else if(next_page.indexOf("QIS_") >= 0){
		if(restart_time > 55)
		  restart_time = 75; // fix 1.0.1.5
		if(getflag.length > 0)
			document.redirectForm.flag.value = getflag;
		
		if(next_page == "/qis/QIS_internet_success.htm" || next_page == "/qis/QIS_finish.htm"){
			;
		}
		else{
			if(getflag == "auto_way_vpn"){
				/*parent.showLoading(restart_time, "waiting");
				setTimeout("parent.parent.detectLANstatus('', 'detectWAN');", restart_time*1000);//*/
				parent.showLoading(restart_time);
				setTimeout("delay_redirect('/qis/QIS_detectWAN.htm');", restart_time*1000);
				return;
			}
			
			parent.showLoading(restart_time, "waiting");
			if(parent.parent.isWLclient())
				setTimeout("parent.parent.detectLANstatus('"+next_page+"', '"+getflag+"');", restart_time*1000);
			else
				setTimeout("top_delay_redirect('"+next_page+"');", restart_time*1000);
		}
	}
	else if(action_script.indexOf("hostname_check") >= 0){
		if(current_page.indexOf("Advanced_ASUSDDNS_Content.asp")>=0)
			setTimeout("parent.parent.checkDDNSReturnCode();", 1000);
		else
			setTimeout("parent.checkDDNSReturnCode();", 1000);
	}
	else if(action_script.indexOf("restart_ddns") >= 0) {
		setTimeout("parent.parent.checkDDNSReturnCode();", 1000);
	}
	else if(page_modified == 1){
		parent.showLoading(restart_time, "waiting");
		if(current_page.length > 0){
			if(current_page.indexOf("clients.asp") >= 0){
				document.redirectForm.flag.value = "Client";
				setTimeout("top_delay_redirect('/');", restart_time*1000);
			}
			else if(current_page == "Advanced_LAN_Content.asp" || current_page == "Advanced_OperationMode_Content.asp" || current_page == "Advanced_APLAN_Content.asp"){
				parent.$('drword').innerHTML = "<#LAN_IP_changed_suggedtion1#>"+parent.document.form.lan_ipaddr.value+"<#LAN_IP_changed_suggedtion2#><br/>";
				setTimeout("hideLoading()	",58000);
				setTimeout("parent.dr_advise();",58000);
				setTimeout("redirect()",63000);
			}
			else if(getflag == "nodetect"){
				setTimeout("top_delay_redirect('"+current_page+"');", restart_time*1000);
			}
			else{
				setTimeout("parent.parent.detectLANstatus('"+current_page+"', '');", restart_time*1000);
			}
		}
	}
	else{
		if(current_page.length > 0){
			setTimeout("top_delay_redirect('"+current_page+"');", restart_time*1000);
		}
		/*else if(next_page.indexOf("/") >= 0 ||
				next_page.indexOf("gotoHomePage.htm") >= 0 ||
				next_page.indexOf("as.asp") >= 0){
			setTimeout("top_delay_redirect('"+next_page+"');", restart_time*1000);
		}//*/
		else if(next_page.length > 0){
			setTimeout("delay_redirect('"+next_page+"');", restart_time*1000);
		}
	}
}

function hideLoading(){
	parent.$("loadingBlock").style.visibility = "hidden";
  parent.$("Loading").style.width = "10px";
}
</script>
</head>

<body onload="initial();">
<form method="post" name="redirectForm" action="" target="">
<input type="hidden" name="flag" value="">
<input type="hidden" name="prev_page" value="">
</form>

<% update_variables(); %>
<% convert_asus_variables(); %>
<% asus_nvram_commit(); %>
<% notify_services(); %>

</body>
</html>
